import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import junit.framework.TestCase;

public class TestThatEventFieldInOutputFile
    extends TestCase {
    public TestThatEventFieldInOutputFile(String name) {
        super(name);
    }
    public void test() {
        appointment ap = new appointment();
        // change fields
        ap.eventName.setText("Foo");
        ap.comboBox.setSelectedIndex(1);
        ap.comboBox_1.setSelectedIndex(2);
        ap.setDateToToday();
        ap.btnNewButton.doClick();
        
        
        
        // read output file
        try {
			BufferedReader br = new BufferedReader(new FileReader("test.ics"));
			boolean found = false;
			//Iterator<String> it =
			String line;
			while ((line = br.readLine()) != null) {
				if (line.equals("SUMMARY:Foo")) {
					found = true;
				}
			}
			assertEquals(true, found);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        //assertEquals("Hello World!", hi.say());
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    public static void main(String[] args) {
        junit.textui.TestRunner.run(
            TestThatEventFieldInOutputFile.class);
    }
}